<?php
class account{
	private $_username	=	'username';
	private $_email		=	'email';
	private $_fullname	=	'fullname';
	private $_balances	=	'main_balances';
	private $_table		=	'account';
	
	function set_username($username = null)
	{
		$this->_username	=	$username;
	}
	
	function set_email($email = null)
	{
		$this->_email	=	$email;
	}
	
	function set_fullname($fullname = null)
	{
		$this->_fullname	=	$fullname;
	}
	
	function check_login($user, $pass)
	{
		global $DB;
		$pass	=	md5($pass);
		$row	=	$DB->query("SELECT * FROM $this->_table WHERE username='$user' AND password='$pass' AND status='active'");
		$row	=	$DB->fetch_row($row);
		if($row)
			return $row;
		return null;
	}
	
	function get_info()
	{
		
	}
	
	function is_login()
	{
		if(isset($_SESSION['user']) && $_SESSION['user'])
		{
			return $_SESSION['user'];
		}
		return false;
	}
	
	function get_balances($username = null)
	{
		global $DB;
		$row	=	$DB->query("SELECT main_balances FROM $this->_table WHERE username='$username'");
		$row	=	$DB->fetch_row($row);
		if($row)
			return $row[0];
		return 0;
	}
	
	function get_username()
	{
		return $this->_fullname;
	}
	
	function get_email()
	{
		return $this->_email;
	}
	
	function get_fullname()
	{
		return $this->_fullname;
	}
	
	
}